#include <iostream>
#include <cmath>
#include "Sort.h"
#include "Timer.h"
#include "stdlib.h"

using namespace std;
using namespace rebeater;

void testDouble() {
  double ds[] = {1.1, 1.001, 1.000001, 1.0000, 0.000001, 1.0000, -1, -0.01, -1.01, M_PI};
  for (double d:ds) {
	printDouble(d, 15);
	printf("\n");
  }
  char buffer[50];
  sprintDouble(buffer, -431253422.1231232, 6);
  cout << buffer;
}

#include "Mathematics.h"

void testPow() {
  Timer t;
  double a;
  int b;
  cin >> a >> b;
  t.reset();
  cout << pow(a, b) << endl;
  cout << t.elapsed_micro() << endl;
  t.reset();
  cout << rebeater::Mathematics::pow(a, b) << endl;
  cout << t.elapsed_micro() << endl;

}
#include "Tree.h"
void testTree() {

}
#include<iostream>

void printResult(int start,int len){
  for(int i  = start; i < start + len; i++){
    printf("%d ",i);
  }
//  while()
}
bool isInt(double i){
  return (i-int(i)<1e-20);
}
#include<bits/stdc++.h>
using namespace std;
int p[10];
int findset(int x){
  return p[x] == x ? x : p[x] = findset(p[x]);
}
int main(){
  int n = 8;
  for(int i = 1; i <= n; ++i){
	p[i] = i;
  }
  p[findset(1)] = findset(3);
  p[findset(2)] = findset(8);
  p[findset(3)] = findset(5);
  p[findset(7)] = findset(4);
  int tot = 0;
  for(int i = 1; i <= 8; ++i){
	tot += (p[i] == i);
  }
  cout<< tot << endl;
  return 0;
}